//
//  LBVintageLowFilter.mm
//  OpenGLGame
//
//  Created by Nguyen Cong Huy on 3/29/13.
//  Copyright (c) 2013 UIT. All rights reserved.
//

#include "LBVintageLowFilter.h"
#include "LBOverlayTextureFilter.h"
#include "LBExclusionColorFilter.h"
#include "LBSoftlightColorFilter.h"
#include "LBContrastFilter.h"
#include "LBBrightnessFilter.h"
#include "LBUtils.h"

LBVintageLowFilter::LBVintageLowFilter(){
    overlayGradient = new LBOverlayTextureFilter();
    overlayGradient->setOpactiy(0.2);
    
    exclusionBlue = new LBExclusionColorFilter();
    exclusionBlue->setOpactiy(0.5);
    exclusionBlue->setColor(0.0, 0.047, 0.259);
    
    softlightYellow = new LBSoftlightColorFilter();
    softlightYellow->setColor(0.816, 0.643, 0.373);
    softlightYellow->setOpactiy(0.2);
    
    contrast = new LBContrastFilter();
    contrast->setContrast(1.1);
    
    brightness = new LBBrightnessFilter();
    brightness->setBrightness(0.1);
    
    overlayGradient->addTarget(exclusionBlue)->addTarget(softlightYellow)->addTarget(contrast)->addTarget(brightness);
    firstFilter = overlayGradient;
}

LBVintageLowFilter::~LBVintageLowFilter(){
    outputTexture = 0;
    DELETE_SAFELY(overlayGradient);
    DELETE_SAFELY(exclusionBlue);
    DELETE_SAFELY(softlightYellow);
    DELETE_SAFELY(contrast);
    DELETE_SAFELY(brightness);
}

void LBVintageLowFilter::setBlendTexture(LBTexture* blendTexture){
    overlayGradient->setBlendTexture(blendTexture);
}